home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qprinter.h.z / qprinter.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.8 KB  |  157 lines

  1. /**********************************************************************
  2. ** $Id: qprinter.h,v 2.8 1998/07/03 00:09:38 hanord Exp $
  3. **
  4. ** Definition of QPrinter class
  5. **
  6. ** Created : 940927
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QPRINTER_H
  25. #define QPRINTER_H
  26.  
  27. #ifndef QT_H
  28. #include "qpaintdevice.h"
  29. #include "qstring.h"
  30. #endif // QT_H
  31.  
  32.  
  33. class QPrinter : public QPaintDevice
  34. {
  35. public:
  36.     QPrinter();
  37.    ~QPrinter();
  38.  
  39.     enum Orientation { Portrait, Landscape };
  40.     enum PageSize    { A4, B5, Letter, Legal, Executive };
  41.     enum PageOrder   { FirstPageFirst, LastPageFirst };
  42.     enum ColorMode   { GrayScale, Color };
  43.  
  44.     const char *printerName()    const;
  45.     void    setPrinterName( const char * );
  46.     bool    outputToFile()    const;
  47.     void    setOutputToFile( bool );
  48.     const char *outputFileName()const;
  49.     void    setOutputFileName( const char * );
  50.     const char *printProgram()    const;
  51.     void    setPrintProgram( const char * );
  52.  
  53.     const char *docName()    const;
  54.     void    setDocName( const char * );
  55.     const char *creator()    const;
  56.     void    setCreator( const char * );
  57.  
  58.     Orientation orientation()    const;
  59.     void    setOrientation( Orientation );
  60.     PageSize    pageSize()    const;
  61.     void    setPageSize( PageSize );
  62.  
  63.     void    setPageOrder( PageOrder );
  64.     PageOrder    pageOrder() const;
  65.     
  66.     void    setColorMode( ColorMode );
  67.     ColorMode    colorMode() const;
  68.  
  69.     int        fromPage()    const;
  70.     int        toPage()    const;
  71.     void    setFromTo( int fromPage, int toPage );
  72.     int        minPage()    const;
  73.     int        maxPage()    const;
  74.     void    setMinMax( int minPage, int maxPage );
  75.     int        numCopies()    const;
  76.     void    setNumCopies( int );
  77.  
  78.     bool    newPage();
  79.     bool    abort();
  80.     bool    aborted()    const;
  81.  
  82.     bool    setup( QWidget *parent = 0 );
  83.  
  84. protected:
  85.     bool    cmd( int, QPainter *, QPDevCmdParam * );
  86.     int        metric( int ) const;
  87.  
  88. #if defined(_WS_WIN_)
  89.     void    setActive();
  90.     void    setIdle();
  91. #endif
  92.  
  93. private:
  94. #if defined(_WS_X11_)
  95.     QPaintDevice *pdrv;
  96. #endif
  97.     int        state;
  98.     QString    printer_name;
  99.     QString    output_filename;
  100.     bool    output_file;
  101.     QString    print_prog;
  102.     QString    doc_name;
  103.     QString    creator_name;
  104.     Orientation orient;
  105.     PageSize    page_size;
  106.     short    from_pg, to_pg;
  107.     short    min_pg,     max_pg;
  108.     short    ncopies;
  109.  
  110. private:    // Disabled copy constructor and operator=
  111.     QPrinter( const QPrinter & );
  112.     QPrinter &operator=( const QPrinter & );
  113. };
  114.  
  115.  
  116. inline const char *QPrinter::printerName() const
  117. { return printer_name; }
  118.  
  119. inline bool QPrinter::outputToFile() const
  120. { return output_file; }
  121.  
  122. inline const char *QPrinter::outputFileName() const
  123. { return output_filename; }
  124.  
  125. inline const char *QPrinter::printProgram() const
  126. { return print_prog; }
  127.  
  128. inline const char *QPrinter::docName() const
  129. { return doc_name; }
  130.  
  131. inline const char *QPrinter::creator() const
  132. { return creator_name; }
  133.  
  134. inline QPrinter::PageSize QPrinter::pageSize() const
  135. { return (PageSize) ( ((int)page_size) & 255 ); }
  136.  
  137. inline QPrinter::Orientation QPrinter::orientation() const
  138. { return orient; }
  139.  
  140. inline int QPrinter::fromPage() const
  141. { return from_pg; }
  142.  
  143. inline int QPrinter::toPage() const
  144. { return to_pg; }
  145.  
  146. inline int QPrinter::minPage() const
  147. { return min_pg; }
  148.  
  149. inline int QPrinter::maxPage() const
  150. { return max_pg; }
  151.  
  152. inline int QPrinter::numCopies() const
  153. { return ncopies; }
  154.  
  155.  
  156. #endif // QPRINTER_H
  157.